//-------------------------------------------------------------------------------------------------
//  quad.hpp - Definition of quad class (plane of finite size) for physics operations
//  (c) 2009 Simon Miessler
//-------------------------------------------------------------------------------------------------

#pragma once

#include <boost/optional.hpp>

#include "math_exports.hpp"
#include "plane.hpp"
#include "raycastable.hpp"




namespace math
{
	template <typename T>
	class quad
		: public intersectable< quad<T> >
		, public raycastable< quad<T>, T >
	{
	public:

		typedef T   float_t;

	public:

		/// The infinite plane
		plane<T>     p;

		/// The size of the quad
		/// The quad extends to size in each direction, thus
		/// size = 0.5 means that each edge has a length of 1.
		vector2<T>   size;

	public:

		quad()
			: size(0.5,0.5)
		{}
	};
	///////////////////////////////////////////////////////////////////////////////////////////////

	/**
	 * In order to compile a binary that actually contains the code for our quads,
	 * we have to explicitly instantiate the template quads and export those:
	 */
	template struct MATH_API intersectable< quad<float> >;
	template struct MATH_API intersectable< quad<double> >;
	template struct MATH_API raycastable< quad<float>, float>;
	template struct MATH_API raycastable< quad<double>, double>;
	template class MATH_API quad<float>;
	template class MATH_API quad<double>;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
